{template 'header', 'member'}
<!--main-block start-->
<div class="main-block bd-gray mt10">
<div class="hd fn-clear">
	<h2 class="fn-left">发布{$MOD[name]}</h2>
</div>
<ul id="data-nav" class="main-nav mt10 fn-clear">
	<li id="status_"><a href="{url('member/my')}?mid={$mid}&action=add">添加{$MOD[name]}</a></li>
	<li id="status_3"><a href="{url('member/my')}?mid={$mid}">已发布({$nums[3]})</a></li>
	<li id="status_2"><a href="{url('member/my')}?mid={$mid}&status=2">审核中({$nums[2]})</a></li>
	<li id="status_1"><a href="{url('member/my')}?mid={$mid}&status=1">未通过({$nums[1]})</a></li>
	<li id="status_4"><a href="{url('member/my')}?mid={$mid}&status=4">已过期({$nums[4]})</a></li>
</ul>
{if $action=='add' || $action=='edit'}
<form id="pub-form" name="pub-form" method="post" action="{url('member/my')}">
	<input type="hidden" name="action" value="{$action}"/>
	<input type="hidden" name="mid" value="{$mid}"/>
	<input type="hidden" name="itemid" value="{$itemid}"/>
	<input type="hidden" name="forward" value="{$forward}"/>
	<table class="data-form">
		{if $status==1 && $action=='edit' && $note}
		<tr>
			<th width="90">未通过原因</th>
			<td width="640">{$note}</td>
		</tr>
		{/if}
		<tr>
			<th width="90"><span class="cred">*</span> {$MOD[name]}类型</th>
			<td width="640">
				{loop $TYPE $k $v}
				<input id="typeid_{$k}" class="nobd fn-left mr5" type="radio" name="post[typeid]" value="{$k}" {if $k==$typeid}checked{/if}/>
				<label class="fn-left mr10" for="typeid_{$k}" id="t_{$k}">{$v}</label>&nbsp;
				{/loop}
			</td>
		</tr>
		<tr>
			<th width="90"><span class="cred">*</span> {$MOD[name]}标题</th>
			<td width="640"><input name="post[title]" type="text" id="title" size="50" class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[3,50]',invalidMessage:'长度在3-50内',missingMessage:'请输入标题'" value="{$title}"/> （2-30个字）<span id="dtitle" class="cred"></span></td>
		</tr>
		<tr>
			<th width="90"><span class="cred">*</span> {$MOD[name]}分类</th>
			<td width="640">{Post::catTree('post[catid]', $moduleid, '选择分类' ,$catid, 'class="easyui-validatebox" data-options="required:true,missingMessage:\'请选择分类\'"')} <span id="dcatid" class="cred"></span></td>
		</tr>
		<tr id="carcatTr" >
			<th width="90">适用车型</th>
			<td width="640">
				{Post::autoCombo('post[arbid][]','post[arcid][]', 'post[amid][]', $item['arbid'],$item['arcid'],$item['amid'], 0, 0, 0)}
			</td>
		</tr>

		<tr>
			<th>{$MOD[name]}条件</th>
			<td class="tr">
				<table>
					<tr>
						<td><label for="buy-num">需求数量</label></td>
						<td><input id="buy-num" name="post[amount]" type="text" size="20" value="{$amount}" class="graybd-ipt"/></td>
					</tr>
					<tr>
						<td><label for="price">价格要求</label></td>
						<td><input id="price" name="post[price]" type="text" size="20" value="{$price}" class="graybd-ipt"/></td>
					</tr>
					<tr>
						<td>{$MOD['name']}说明</td>
						<td><textarea name="post[introduce]" style="width:425px;height:45px;" class="graybd-ipt">{$introduce}</textarea></td>
					</tr>
				</table>
				<p class="mt10 c666">建议详细填写交易条件，以便符合要求的卖家/客户及时与您取得联系</p>
			</td>
		</tr>

		<tr>
			<th width="90">{$MOD[name]}图片</th>
			<td width="640">{Post::picture($moduleid, 'thumb', 'post[thumb]', $thumb ,$MOD['thumb_width'], $MOD['thumb_height'])}</td>
		</tr>
		{if $IMVIP || !$MG[uploadpt]}
		<tr>
			<th width="90">{$MOD[name]}图片</th>
			<td width="640">{Post::picture($moduleid, 'thumb', 'post[thumb1]', $thumb1 ,$MOD['thumb_width'], $MOD['thumb_height'])}</td>
		</tr>
		<tr>
			<th width="90">{$MOD[name]}图片</th>
			<td width="640">{Post::picture($moduleid, 'thumb', 'post[thumb2]', $thumb2 ,$MOD['thumb_width'], $MOD['thumb_height'])}</td>
		</tr>
		{/if}
		<tr>
			<th width="90">详细说明</th>
			<td width="640">
				{Post::kindEditor('post[content]', $moduleid, $content,'','675px','280px')}
			</td>
		</tr>
		<tr>
			<th>过期时间</th>
			<td class="tr f_gray">{Post::calender('post[totime]', $totime, 'width:100', true)}
			</td>
		</tr>
		<tr>
			<th>发布地区</th>
			<td class="tr">
				{if $action == 'add'}
				{Post::areaCombo('post[areaid]', $userInfo[areaid], '', '', $moduleid )}
				{elseif $action =='edit'}
				{Post::areaCombo('post[areaid]', $areaid, '', '', $moduleid )}
				{/if}
			</td>
		</tr>
		{if $MG['memtype'] >= 5}
		<tr>
			<th width="90"><span class="cred">*</span>发布单位 </th>
			<td width="640"><input name="post[company]" type="text" {if $_groupid>5}class="easyui-validatebox graybd-ipt" data-options="required:true,validType:'length[3,50]',missingMessage:'请填写发布单位'" {/if}size="50"  value="{if $company}{$company}{else}{$userinfo[company]}{/if}"/> </td>
		</tr>
		{/if}
		<tr>
			<th width="90"><span class="cred">*</span> 联系人</th>
			<td width="640"><input name="post[truename]" type="text" id="truename" class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写联系人'"  size="20" datatype="*2-999" nullmsg="请填写联系人" errormsg="最少输入2个字符"  value="{if $truename}{$truename}{else}{$userinfo[truename]}{/if}" /> <br/>
		</tr>
		<tr>
			<th width="90">{if $MG['memtype'] >= 5}<span class="cred">*</span>{/if} 联系电话</th>
			<td width="640"><input name="post[telephone]" type="text" size="30" {if $MG['memtype'] >= 5}class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[3,50]',missingMessage:'请填写联系电话'"{/if}  value="{if $telephone}{$telephone}{else}{$userinfo[telephone]}{/if}" /></td>
		</tr>
		<tr>
			<th width="90"><span class="cred">*</span> 联系手机</th>
			<td width="640"><input name="post[mobile]" type="text" size="30" class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[3,50]',missingMessage:'请填写联系手机'" value="{if $mobile}{$mobile}{else}{$userinfo[mobile]}{/if}" /></td>
		</tr>
		<tr>
			<th width="90">联系地址</th>
			<td width="640"><input name="post[address]" type="text" size="60" class="easyui-validatebox graybd-ipt" value="{if $address}{$address}{else}{$userinfo[address]}{/if}"/></td>
		</tr>
		{if !$_userid}
		{template 'guest_contact', 'chip'}
		{/if}
		{if $need_captcha}
		<tr>
			<th><span class="cred">*</span> 验证码</th>
			<td class="tr">{template 'captcha', 'chip'} <span id="dcaptcha" class="cred"></span></td>
		</tr>
		{/if}
		<tr>
			<th>&nbsp;</th>
			<td class="sub-info">
				<button type="submit" class="btn" >提 交</button>
				<input type="button" value=" 返 回 " class="btn" onclick="history.back(-1);"/>
			</td>
		</tr>
	</table>
</form>
<script type="text/javascript">
	seajs.use(['$', 'easyui','easyui-css'], function ($) {
		$("#pub-form").form();
	});
</script>
{/if}
</div>
<script type="text/javascript">
	seajs.use(['member'], function(member){
		member.active('menu_info', 'mid_{$moduleid}', 'status_{$status}')
	})
</script>
{template 'footer', 'member'}